//
//  HeadViewModel.swift
//  ListenFM
//
//  Created by szq on 2017/8/8.
//  Copyright © 2017年 胡定锋. All rights reserved.
//

import Foundation
import HandyJSON


class HeadViewModel:HandyJSON{
    
    var code = ""
    var count = ""
    var data:[HeadDataModel] = []
    
    required init() {}
}

class HeadDataModel:HandyJSON{
    
    var count = ""
    var cover = ""
    var flag = ""
    var id = ""
    var name = ""
    var sort = ""
    var title = ""
    
    required init() {}
}

class DownHeadData{
    
    class func loadData(params : [String : Any]?,success : @escaping (HeadViewModel)->(), failture : @escaping (NSError)->()) {
        
        NetworkTool.GET(URLString: "http://bapi.xinli001.com/fm2/hot_tag_list.json/?flag=4&key=c0d28ec0954084b4426223366293d190&rows=3&offset=0", params: params, success: { (result) in
            
            print("发现页面")
            if let headModel = HeadViewModel.deserialize(from:result){
                //model处理后传出
                success(headModel)
            
            }
            
        }) { (error) in
            // 传出错误信息
            failture(error)
        }
    }
    
}
